(ns ^{:doc "A util namespace for REPL testing."}
  repl
  (:require [clj.jtacck.db.core :as db]
	    [clj.jtacck.web.core :as web]
	    [clj.jtacck.web.templates :as t]
	    [clj.jtacck.db.routing :as r]
	    [clj.jtacck.logging :as log])
  (:use [bake.reload :only [reload-namespaces]])
  (:import jvm.jtacck.db.AwesomeCoreHandler))

(defn bind-logger []
  (log/bind-stdouterr-to-logger))

(defn db-start
  "Simply starts a db connection with some stock credentials."
  []
  (db/start-db-connection "codeblack" "" "localhost:5432/tracking_system"))

(defn reload []
  (reload-namespaces 'clj.jtacck.db.routing
		     'clj.jtacck.web.templates
		     'clj.jtacck.web.core
		     'clj.jtacck.db.core
		     'clj.jtacck.logging))

(defn restart-web []
  (do
    (web/stop-server)
    (reload)
    (db-start)
    (web/start-server 8080)))